//
//  AppDelegate.swift
//  sandbox
//
//  Created by 杨岑 on 2018/7/25.
//  Copyright © 2018 杨岑. All rights reserved.
//

import Cocoa

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
    @IBOutlet weak var testMenu: NSMenu!
    
    func applicationDidFinishLaunching(_ aNotification: Notification) {
        print("Application launching: \(aNotification)")
        print(Locale.current)
    }

    func applicationWillTerminate(_ aNotification: Notification) {
        print("Application terminating: \(aNotification)")
    }

    func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
        return true
    }

    @IBAction func test(_ sender: Any) {
        let menuItem = sender as? NSMenuItem
        print(menuItem?.identifier?.rawValue as Any)
        let menu = menuItem!.menu?.copy() as! NSMenu
        for item in menu.items {
            print(item.identifier?.rawValue as Any)
        }
    }
    
}
